package com.ruoyi.ruoyixingyue.modules.api.controller;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageData;
import com.ruoyi.ruoyixingyue.modules.api.entity.CourseType;
import com.ruoyi.ruoyixingyue.modules.api.po.CourseAdminListPo;
import com.ruoyi.ruoyixingyue.modules.api.po.CourseInsertPo;
import com.ruoyi.ruoyixingyue.modules.api.po.CourseListPo;
import com.ruoyi.ruoyixingyue.modules.api.service.ICourseService;
import com.ruoyi.ruoyixingyue.modules.api.service.ICourseTypeService;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseAdminListVo;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseInsertVo;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseListVo;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseUpdateVo;
import com.ruoyi.ruoyixingyue.modules.utils.Condition;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 课程表 前端控制器
 * </p>
 *
 * @author lzz
 * @since 2024-02-14
 */
@RestController
@RequestMapping("/course")
public class CourseController {

    @Autowired
    private ICourseService iCourseService;

    @ApiOperation("课程类型list")
    @PostMapping("/course/list/API_001")
    public R<PageData<CourseListPo>> courseListAPI_001(@RequestBody Condition<CourseListVo> condition) {
        return iCourseService.courseListAPI_001(condition);
    }

    @ApiOperation("课程分类list")
    @PostMapping("/courseType/list/API_002/{id}")
    public R<List<CourseListPo>> courseTypeListAPI_002(@PathVariable("id") Long id) {
        return iCourseService.courseTypeListAPI_002(id);
    }

    @ApiOperation("后台课程类型list")
    @PostMapping("/course/list/API_003")
    public R<PageData<CourseAdminListPo>> courseListAPI_003(@RequestBody Condition<CourseAdminListVo> condition) {
        return iCourseService.courseListAPI_003(condition);
    }

    @ApiOperation("添加课程")
    @PostMapping("/course/insert/API_004")
    public R<String> courseInsertAPI_004(@RequestBody CourseInsertVo courseInsertVo) {
        return iCourseService.courseInsertAPI_004(courseInsertVo);
    }

    @ApiOperation("根据id回显信息")
    @PostMapping("/course/getById/API_005/{id}")
    public R<CourseInsertPo> courseGetByIdAPI_005(@PathVariable("id") Long id) {
        return iCourseService.courseGetByIdAPI_005(id);
    }

    @ApiOperation("更新课程信息")
    @PostMapping("/course/update/API_006")
    public R<String> courseUpdateAPI_006(@RequestBody CourseUpdateVo courseUpdateVo) {
        return iCourseService.courseUpdateAPI_006(courseUpdateVo);
    }

    @ApiOperation("删除课程信息")
    @PostMapping("/course/delete/API_007/{id}")
    public R<String> courseDeleteAPI_006(@PathVariable("id") Long id) {
        return iCourseService.courseDeleteAPI_006(id);
    }

    @ApiOperation("课程字典信息")
    @PostMapping("/course/dict/API_008")
    public R<List> courseDictAPI_008() {
        return iCourseService.courseDictAPI_008();
    }
}
